package com.jiyun.home.controller;

import cn.hutool.log.Log;
import com.jiyun.Result.Result;
import com.jiyun.common.pojo.product.OrderInfo;
import com.jiyun.home.service.WxPayService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 文件名: WeixinPayController
 * 创建者: 仵老师
 * 创建时间:2022/8/8 15:55
 * 描述: 这是一个示例
 */
@RestController
@RequestMapping("wxpay")
@Slf4j
public class WeixinPayController {


    @Autowired
    private WxPayService wxPayService;


    @RequestMapping("getQrCodeUrl/{trade}")
    public Result getQrCodeUrl(@PathVariable("trade")String trade) throws Exception{
        return wxPayService.getQrCodeUrl(trade);
    }
    @PostMapping("orderquery")
    public String orderquery(@RequestBody OrderInfo orderInfo,Integer id) throws Exception{
        log.info("orderquery:{},{}",orderInfo,id);
        return wxPayService.orderquery(orderInfo,id);
    }
}
